﻿#pragma once

#include "Containers/Delegate.h"

class RtAudio;

using RtAudioStreamStatus=unsigned int;

//由于RtAudio头文件中有一些宏定义，容易冲突，所以需要包装一下
class RtAudioWarpper
{
public:
    RtAudioWarpper();
    ~RtAudioWarpper();


    TDelegate<uint64_t /*Copyed Frame Num*/ , void * /*Dst Buffer*/ , uint64_t /*FrameNum*/> DataGetter;

    void OpenStream(
        int64_t InSampleRate,
        int64_t InNumChannels,
        int64_t InBitsPerSample 
    );
    void CloseStream();
    bool IsStreamOpened();

    void StartStream();
    void StopStream();
    bool IsStreamRunning();

    uint64_t GetFrameDataSize() const { return FrameDataSize; }
protected:
    RtAudio * Stream=nullptr;
    uint64_t FrameDataSize=0;
   
};
